/*
 *  Copyright (c) 2022 ZhuHai Jieli Technology Co.,Ltd.
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

#ifndef JIFFIES_H
#define JIFFIES_H
/* timer interface */
/* Parameters used to convert the timespec values: */
#define HZ                100L
#define MSEC_PER_SEC    1000L
#define USEC_PER_MSEC    1000L
#define NSEC_PER_USEC    1000L
#define NSEC_PER_MSEC    1000000L
#define USEC_PER_SEC    1000000L
#define NSEC_PER_SEC    1000000000L
#define FSEC_PER_SEC    1000000000000000LL

#ifndef __ASSEMBLY__
extern volatile unsigned long jiffies;
extern unsigned long jiffies_msec(void);
extern unsigned long jiffies_half_msec(void);
#endif

#define JIFFIES_CIRCLE                  0x7FFFFFF

#define time_after(a, b)                    ((long)(b) - (long)(a) < 0)
#define time_before(a, b)                time_after(b, a)

extern unsigned char jiffies_unit;

#define msecs_to_jiffies(msec)             ((msec) / jiffies_unit)
#define jiffies_to_msecs(j)             ((j) * jiffies_unit)

#endif

